class PostController < ApplicationController
	def index
		@post_pages, @posts = paginate :posts, :per_page => 10
	end

	def list
		@post_pages, @posts = paginate :posts, :per_page => 10
		render :layout => false
	end	

	def view
		@post = Post.find(params[:id])	
		@comments = @post.comments
		render :layout => false
	end

	def comment
		@comment = Comment.new(params[:comment])
		@comment.post_id = params[:id]
		@comment.comment_on = Time.now
		if @comment.save
			flash[:notice] = 'Comment was successfully added!'
			render :partial => 'comment'
		else
			render :nothing => true
		end
	end
end
